import BaseComponent from "../../../common/components/common/BaseComponent";
// import Container from "./Container";
import React from "react";
import Board from "./Board";
import { observe } from "./game";

class Page2 extends BaseComponent<any, any>{
  private unobserve: any = observe(this.handleChange.bind(this))
	public componentWillUnmount() {
		this.unobserve()
	}
  public render(){
    // return <Container />
    return  <div style={{ width: 200, height: 200, background: 'red' }}>

    <Board knightPosition={this.state.knightPosition} />
    </div>
  }

  private handleChange(knightPosition: [number, number]) {
		const nextState = { knightPosition }
		console.log('nextState', nextState)
		if (this.state) {
			this.setState(nextState)
		} else {
			this.state = nextState
		}
	}


}

export default Page2